Tegra: sip_calls: fix defects flagged by MISRA scan
authorAnthony Zhou <[email protected]>
Wed, 1 Mar 2017 04:47:37 +0000 (12:47 +0800)
committerVarun Wadekar <[email protected]>
Wed, 16 Jan 2019 18:11:06 +0000 (10:11 -0800)
Main fixes:

* Expressions resulting from the expansion of macro parameters
  shall be enclosed in parentheses [Rule 20.7]
* Added explicit casts (e.g. 0U) to integers in order for them
  to be compatible with whatever operation they're used in [Rule
  10.1]
* Fix implicit widening of composite assignment [Rule 10.6]

Change-Id: Ia83c3ab6e4c8c03c19c950978a7936ebfc290590
Signed-off-by: Anthony Zhou <[email protected]>
Signed-off-by: Varun Wadekar <[email protected]>
plat/nvidia/tegra/common/tegra_sip_calls.c
plat/nvidia/tegra/include/tegra_private.h
plat/nvidia/tegra/soc/t132/plat_sip_calls.c
plat/nvidia/tegra/soc/t186/plat_sip_calls.c

index e50d12faf89de0165c7a858fd73bdf4c0e9dbfdc..2c3be60f76e545f2665aa00886156e18f0134d51 100644 (file)
@@ -41,10 +41,20 @@ int plat_sip_handler(uint32_t smc_fid,
                     uint64_t x2,
                     uint64_t x3,
                     uint64_t x4,
-                    void *cookie,
+                    const void *cookie,
                     void *handle,
                     uint64_t flags)
 {
+       /* unused parameters */
+       (void)smc_fid;
+       (void)x1;
+       (void)x2;
+       (void)x3;
+       (void)x4;
+       (void)cookie;
+       (void)handle;
+       (void)flags;
+
        return -ENOTSUP;
 }
 
@@ -61,7 +71,7 @@ uintptr_t tegra_sip_handler(uint32_t smc_fid,
                            u_register_t flags)
 {
        uint32_t regval;
-       int err;
+       int32_t err;
 
        /* Check if this is a SoC specific SiP */
        err = plat_sip_handler(smc_fid, x1, x2, x3, x4, cookie, handle, flags);
@@ -176,9 +186,9 @@ uintptr_t tegra_sip_handler(uint32_t smc_fid,
 DECLARE_RT_SVC(
        tegra_sip_fast,
 
-       OEN_SIP_START,
-       OEN_SIP_END,
-       SMC_TYPE_FAST,
-       NULL,
-       tegra_sip_handler
+       (OEN_SIP_START),
+       (OEN_SIP_END),
+       (SMC_TYPE_FAST),
+       (NULL),
+       (tegra_sip_handler)
 );
index 1fa04adceb018b93fce0d1ee634b1e10b6d482b3..ff3d6d2cd8fda4a208f55a461fd6532ef9cb622c 100644 (file)
@@ -99,4 +99,22 @@ void tegra_delay_timer_init(void);
 void tegra_secure_entrypoint(void);
 void tegra186_cpu_reset_handler(void);
 
+/* Declarations for tegra_sip_calls.c */
+uintptr_t tegra_sip_handler(uint32_t smc_fid,
+                           u_register_t x1,
+                           u_register_t x2,
+                           u_register_t x3,
+                           u_register_t x4,
+                           void *cookie,
+                           void *handle,
+                           u_register_t flags);
+int plat_sip_handler(uint32_t smc_fid,
+                    uint64_t x1,
+                    uint64_t x2,
+                    uint64_t x3,
+                    uint64_t x4,
+                    const void *cookie,
+                    void *handle,
+                    uint64_t flags);
+
 #endif /* TEGRA_PRIVATE_H */
index 02dd1cd56ca670d2c4202f568d880da5b4c312fd..90c6bb2a1b5a3a232396cf298b752b01b4e9c0e1 100644 (file)
@@ -38,7 +38,7 @@ int plat_sip_handler(uint32_t smc_fid,
                     uint64_t x2,
                     uint64_t x3,
                     uint64_t x4,
-                    void *cookie,
+                    const void *cookie,
                     void *handle,
                     uint64_t flags)
 {
index bf98fcf648b6c3599513bfa47406379b1b33b43a..2e22123bdbab68d20e552c57864e1bae87c1602c 100644 (file)
@@ -60,7 +60,7 @@ int plat_sip_handler(uint32_t smc_fid,
                     uint64_t x2,
                     uint64_t x3,
                     uint64_t x4,
-                    void *cookie,
+                    const void *cookie,
                     void *handle,
                     uint64_t flags)
 {